UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1P2uetgmPO2Sj6CcagdRswnsPpuVbpyzbfhcI+nMisM='
WHERE
key_id = 'b4b51fb07afcb757c800b4295cf9b603ed3b6b70e85b2d5254bce96b58b14c6b'
AND (
token = '1P2uetgmPO2Sj6CcagdRswnsPpuVbpyzbfhcI+nMisM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)