UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jN5FO3tDrgRlGlNI9AaAVJgN2lVNviomzhWISWq9G8c=' 
WHERE 
  key_id = '459d7c10b870da4f2b916dfc6dc0ea0d791eb78bdd5cd3ab6768564dd0d11d51' 
  AND (
    token = 'jN5FO3tDrgRlGlNI9AaAVJgN2lVNviomzhWISWq9G8c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030