UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BqaDB8wi9jTdcE2MY054x7hqBjdhObP4ObNxC6P7XJQ='
WHERE
key_id = 'ff7c5a39e1d10858495970ba0e592dea78580439cb05788251fa3088677b302c'
AND (
token = 'BqaDB8wi9jTdcE2MY054x7hqBjdhObP4ObNxC6P7XJQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)