UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p/umqh/syTgGK23FRceJvIaMb5qsqhYSFyxf57730eY=' 
WHERE 
  key_id = '631f8079147a615aafc49f5f7720dbc77316de95ac4879a57772fd145a2ed032' 
  AND (
    token = 'p/umqh/syTgGK23FRceJvIaMb5qsqhYSFyxf57730eY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034