UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fIk/nsF/ptHoDiQ5u42gvKZ/GffzkvT3kzgeuJz7nv4=' 
WHERE 
  key_id = 'dd0954773d3e7f40d0a670b248cd188a13c0a0295d52780ee6603b722eb86984' 
  AND (
    token = 'fIk/nsF/ptHoDiQ5u42gvKZ/GffzkvT3kzgeuJz7nv4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042