UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hLJAyxAM7giGidTRwD0giBUxR8bJeopnbi60Qz/Gx40='
WHERE
key_id = '24e4986bddeac89dc9b233737fce4c11c1f483fd09120a4b011f82208b616e8d'
AND (
token = 'hLJAyxAM7giGidTRwD0giBUxR8bJeopnbi60Qz/Gx40='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)