UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qcOlo2yOK9/wcd3FhwYwHPsCKrJmj5wPcUjb4xneURI='
WHERE
key_id = 'd77f1fc468198ac367f84c152cc4c8d8289c25632e7497124e2b530d6ab837a9'
AND (
token = 'qcOlo2yOK9/wcd3FhwYwHPsCKrJmj5wPcUjb4xneURI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)