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