UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Aj+83Taj9ov+6xiO8UJej5X+aASFEUhK80/1/pHltfc=' 
WHERE 
  key_id = 'e3bf9616f03f8dafdabd68e34b246c62ce655a2138fb64262a1c1c361ee9ba58' 
  AND (
    token = 'Aj+83Taj9ov+6xiO8UJej5X+aASFEUhK80/1/pHltfc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032