UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kOzo5SqjxOnqBfg3fz+Inb+vSg7bCwug+lhZc6KbLbU=' 
WHERE 
  key_id = 'e2c3b12a1ca422d1ab350501ac88c6b176418c391ac41a1925068337670245b5' 
  AND (
    token = 'kOzo5SqjxOnqBfg3fz+Inb+vSg7bCwug+lhZc6KbLbU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039