UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0EFxK8datn7kECgr5KBBNl89REbnPaStQtbf9BNcu1E='
WHERE
key_id = 'd7da6c9363f5eadf8df54726429d7adca2ad331f793241d808418a5176f1965a'
AND (
token = '0EFxK8datn7kECgr5KBBNl89REbnPaStQtbf9BNcu1E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)