UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hpegCLMs0JZKuAXzCni1xZ2TGHFfXovrFXnxJJs2Ik8='
WHERE
key_id = '36d87c9ad0815962d0b3c2deab87c8694b0abeb0b869864fc2d77a62242ab04d'
AND (
token = 'hpegCLMs0JZKuAXzCni1xZ2TGHFfXovrFXnxJJs2Ik8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)