UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Gl2TCk9sQD8qsHWVFFxOomVnNV18EVGPq+pfXidxyzM='
WHERE
key_id = 'd04c0872c967f1f72dfe3aadc5cd0486a5957aa3f65b636a6b82e76db163ca3d'
AND (
token = 'Gl2TCk9sQD8qsHWVFFxOomVnNV18EVGPq+pfXidxyzM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)