UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2MtK6XqE49hCTtIY854yzKy1t9NToc+2D5CRPoybWrY=' 
WHERE 
  key_id = 'e35d0b9767123a6315502302bda91080c3e318682a311e218a7d5e973997073e' 
  AND (
    token = '2MtK6XqE49hCTtIY854yzKy1t9NToc+2D5CRPoybWrY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029