UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8qFEi8uOkk1EghtccnlDXYiaUh4U2znpKntbRtwUAlg='
WHERE
key_id = '41a16640f02391ef51db5c92cd3e585f2b9fca4be4256c56b88db89f3336e61c'
AND (
token = '8qFEi8uOkk1EghtccnlDXYiaUh4U2znpKntbRtwUAlg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)