UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O3rZhA5LpUYGpVkMa+N10NoSzF0M+/ap9RYT2Q1Ccvg=' 
WHERE 
  key_id = 'c546171c8f4e2140ee5b4173f62b21be0fa68585fe0c26e3394cb81e6e232608' 
  AND (
    token = 'O3rZhA5LpUYGpVkMa+N10NoSzF0M+/ap9RYT2Q1Ccvg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027