UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pPjlK6s9XrmsFgxrQCTywpc1eCZG6rOD9ngyyg6yYH8='
WHERE
key_id = '2ecdadf4a3d9026f5ad01b7476890dacf67187fcb01c159f5ddbc35234aab02d'
AND (
token = 'pPjlK6s9XrmsFgxrQCTywpc1eCZG6rOD9ngyyg6yYH8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)