UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cvAljEqAkmd3a3f/cNZIDPubZTogy2SmPRXxBFV+jjI='
WHERE
key_id = '5a3ebebdb9e70a83a76e8e95c16b109b85f5336b6abc13ec9483e9e7d71ee4ab'
AND (
token = 'cvAljEqAkmd3a3f/cNZIDPubZTogy2SmPRXxBFV+jjI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)