UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OryFYwdHTng5ZkpP7gBn+Ks5jSaMXpQjk17HGQK4beU='
WHERE
key_id = 'd9ad64dea3c3d249819aa16f2c83b0e9b755cedda31e3c21a673c26de7115ac2'
AND (
token = 'OryFYwdHTng5ZkpP7gBn+Ks5jSaMXpQjk17HGQK4beU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)