UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bMZWvZRYsLdWGaNaezUPDObZ2lax0S8FxT+zDLbhA1k=' 
WHERE 
  key_id = 'f859da564c972703ff50cbc7234400805881a3f90651456c5f50b4062fc4df35' 
  AND (
    token = 'bMZWvZRYsLdWGaNaezUPDObZ2lax0S8FxT+zDLbhA1k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036