UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0W/wPmYmls+0rrOlbHLrP0emspd41pow4MrQ+JA1PpQ=' 
WHERE 
  key_id = 'e0f3f87b8e11d0c3e4844de0a70fd119429ecad866f9ba383382ea58cb5cde6f' 
  AND (
    token = '0W/wPmYmls+0rrOlbHLrP0emspd41pow4MrQ+JA1PpQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068