UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J9j8S9qT8ElzIO+HjZWR2YMNe1du9ZaMLHj09r7ctlY='
WHERE
key_id = 'd402ef4b91842af425e54aeec89ce05efa1694df39b253d6dcce3e56d473d881'
AND (
token = 'J9j8S9qT8ElzIO+HjZWR2YMNe1du9ZaMLHj09r7ctlY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)