UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rknuDzMnsNnejJIl7wYCU9WOfBdiips5R7BG0wJYloE='
WHERE
key_id = '20df4e9e7a342818ac4899cfa8675b5f4456264d26e3682c8e573d44dd47d0ea'
AND (
token = 'rknuDzMnsNnejJIl7wYCU9WOfBdiips5R7BG0wJYloE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)