UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p8ItD2to6icIwcMIXVIaAVara4cTX2uNCUld1SGp5eY='
WHERE
key_id = '4e788ca1ee857e82380237d181d546648780142c9058b3fefcb44fadd23fc820'
AND (
token = 'p8ItD2to6icIwcMIXVIaAVara4cTX2uNCUld1SGp5eY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)