UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KE2kBvh4b3lKvkP4en9Zf037rfvnZPihoy/FdoFXk+w='
WHERE
key_id = '860d1f891e44eed749b21b1d67c4ef324c4278b4e6d16a9055f55c25f7eb3733'
AND (
token = 'KE2kBvh4b3lKvkP4en9Zf037rfvnZPihoy/FdoFXk+w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)