UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4SpPsgSmFvh49SlkQwZyo3+Y30wgInJLDnuA0C9lD20=' 
WHERE 
  key_id = '7e6535f368e899b8949ab503fb6a7dcca0e6fd07ebc6c697404d94684f7b6169' 
  AND (
    token = '4SpPsgSmFvh49SlkQwZyo3+Y30wgInJLDnuA0C9lD20=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032