UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o0POZ1lpL2cJvliOLT3K7jcIlNdb21Q9brYDvht7jqA='
WHERE
key_id = '9bb8008d1a9528e2189d79bc4c4aaac00213f7380f86a390b74a8762b46514e3'
AND (
token = 'o0POZ1lpL2cJvliOLT3K7jcIlNdb21Q9brYDvht7jqA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)