UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PcwKxWRoPBQZflhWoP3mse420RWuXZPtZdMZ3Nxaj9s='
WHERE
key_id = '20499a1cd222db2d4677997dac63c050229e932fc27bd4405f8b3e13556e7372'
AND (
token = 'PcwKxWRoPBQZflhWoP3mse420RWuXZPtZdMZ3Nxaj9s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)