UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1VqW9ydbOgflckGyk0E87OH50nfxUadba8B1XVvuHWg=' 
WHERE 
  key_id = 'd2e865f6ecf288f594197ca16c9ab67b6a24bae0176d10958f8e6cf6887114eb' 
  AND (
    token = '1VqW9ydbOgflckGyk0E87OH50nfxUadba8B1XVvuHWg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022