UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c86PzknXHvSGJH7ltjxND1fOyGB1s9bho/o0psjQ9Vs='
WHERE
key_id = '517c6722ee252e481718d902168a85ae794e5bed75dba0e6d9a04c3f20ae34ac'
AND (
token = 'c86PzknXHvSGJH7ltjxND1fOyGB1s9bho/o0psjQ9Vs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)