UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FySThOZQdDDDZ9E7BRjNyGU0sCUhIvytlbvmUDoOp4Y=' 
WHERE 
  key_id = 'e4c9f887886b72a8f2b68ec45c7edeb93871eda000e344b07c3190a5e3d7ebdf' 
  AND (
    token = 'FySThOZQdDDDZ9E7BRjNyGU0sCUhIvytlbvmUDoOp4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034