UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g0UkkVj/EKl94TM7jM+IvsxL+kUAdtung24xKpWH+ZQ=' 
WHERE 
  key_id = '4f8f728f900e065cd38c806f1b9020152910412d81d7ed620f4bdb5e2f4fd358' 
  AND (
    token = 'g0UkkVj/EKl94TM7jM+IvsxL+kUAdtung24xKpWH+ZQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028